package Framework;

import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.GameCanvas;

public class CMyCanvas extends GameCanvas 
{

    public CScreenManager screenManager;

    protected CMyCanvas(boolean _isFullScreen, CScreenManager _screenManager) {
        super(true);
        screenManager = _screenManager;
        setFullScreenMode(_isFullScreen);
        CDefine.SCREEN_WIDTH = this.getWidth();
        CDefine.SCREEN_HEIGHT = this.getHeight();
    }

    public Graphics getGraphics() {
        return super.getGraphics();
    }

    public void pointerPressed(int x, int y) {
        this.screenManager.pointerPressed(x, y);
    }

    public void pointerDragged(int x, int y) {
        this.screenManager.pointerDragged(x, y);
    }

    public void pointerReleased(int x, int y) {
        this.screenManager.pointerReleased(x, y);
    }

    // called when canvas is hide by other displayable, or by a system event(low battery, volume change...
    protected void hideNotify() 
    {
       // ResourceManager.getInst().isEnableSound = false;
        //ResourceManager.getInst().sndBgMenu.Stop();
        this.screenManager.pause();
        
    }
    
    // called when canvas is showed
    protected void showNotify() 
    {
        this.screenManager.resume();
        //ResourceManager.getInst().isEnableSound = true;
        //ResourceManager.getInst().sndBgMenu.playloop(60);
        //this.engine.paused = false;
        
    }
        
}